package com.styytech.dadabao.test.ResideMenu;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.styytech.dadabao.R;
import com.styytech.dadabao.widge.ResideMenu.ResideMenu;


/**
 * User: special
 * Date: 13-12-22
 * Time: 下午1:33
 * Mail: specialcyci@gmail.com
 */
public class HomeFragment extends Fragment {

    private View parentView;
    private ResideMenu resideMenu;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        parentView = inflater.inflate(R.layout.test_home, container, false);
        setUpViews();
        return parentView;
    }
    
    private void setUpViews() {
        MenuActivity parentActivity = (MenuActivity) getActivity();
        resideMenu = parentActivity.getResideMenu();
        Log.e("---", "初始化1----------1");
        parentView.findViewById(R.id.btn_open_menu).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
               // resideMenu.openMenu(ResideMenu.DIRECTION_LEFT);
            	 resideMenu.openMenu();
            }
        });

        // add gesture operation's ignored views
        
       RelativeLayout ignored_view = (RelativeLayout) parentView.findViewById(R.id.home);
       /* if (!resideMenu.isOpened()) {
        resideMenu.addIgnoredView(ignored_view);
        }else {
        	 resideMenu.removeIgnoredView(ignored_view);
		}*/
        resideMenu.addIgnoredView(ignored_view);
    }
    
	@Override
	public void onResume() {
		// TODO Auto-generated method stub
		
		super.onResume();
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		 Log.e("---", "初始化1----------2");
		super.onActivityCreated(savedInstanceState);
	}

	@Override
	public void onDestroy() {
		// TODO Auto-generated method stub
		Log.e("---", "销毁----------");
		super.onDestroy();
	}
    
}
